package com.woniuxy.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.cloud.client.ConditionalOnBlockingDiscoveryEnabled;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by xxhcm on 2021/3/24.
 */
@Configuration
public class AmqpConfig {

    @Bean
    public Queue queue(){
        return new Queue("mailQueue");
    }

    @Bean
    public DirectExchange directExchange(){
        return new DirectExchange("mailExchange");
    }
    @Bean
    public Binding binding(){
        return BindingBuilder.bind(queue()).to(directExchange()).with("mailKey");
    }

    @Bean
    public Queue codeQueue(){
        return new Queue("codeQueue");
    }
    @Bean
    public Binding bindingCode(){
        return BindingBuilder.bind(codeQueue()).to(directExchange()).with("codeKey");
    }
}
